<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
	request.setCharacterEncoding("UTF-8");
	String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    String date= format.format(new Date());
%>
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/StudentsListPage.jsp"%>
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/argeeCommon.jsp"%>
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/againstAuditCommon.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css" >
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
</head>
<style>
select{width: 234px;height: 31px}
.gn_name{padding-top: 5px}
.div_zilei{width: 600px;height: 30px}
.tr{height:40px;}
.tr td{font-size: 14px;color: #ffffff;background-color: #57a0ff;font-weight: 700}
.tr_td{height: 40px;}
.tr_td td{border-bottom: 1px solid #ededed;text-align: center;}
tr td:nth-child(1) {font-size: 14px;color: #ffffff;}
.date{border: 0;background: #ffffff;text-align: center;}
.tr_td td:nth-child(1){border-left: 1px solid #cccccc;}
.tr_td td:nth-child(3){border-right: 1px solid #cccccc;}
.deleteTable:HOVER{cursor:pointer;color: #056dae;}
.addTable:HOVER{cursor:pointer;color: #056dae;}
input{height: 31px}	
.div_input_hang{width: 97%;height: 40px;}
.input_hang{width: 30%;height: 40px}
.input_hang input{width: 200px;height: 31px}
.gn_name{width: 90px}
/*input[type=button]{
	width:88px;
	height:26px
}*/
.div_form table input[type=checkbox]{
     width: 35px;
     height:15px;
 }

</style>
<body style="background: #f5f5f5">
<div class="main">
	<div class="weizhi">
		学员管理>>科目一档案交接>>详情
	</div>
	
	<div class="div_body" style="min-height: 900px">	
	
	
		<div class="div_form">
			<!--新增  -->
			<c:if test="${flag eq 1 }">
			<form action="<%=path%>/DrivingSys/saveSubjectFile" class="form">
				<div class="jlxx" >
				<div class="div_input_hang">
						<div class="input_hang">
							<span class="gn_name">驾校&nbsp;:&nbsp;</span>
							<input type="text" value="${department.fnameL2}" disabled="disabled" >						
						</div>
						<div class="input_hang">
							<span class="gn_name">单据编号&nbsp;:&nbsp;</span>
							<input type="text" disabled="disabled" >
						</div>
						<div class="input_hang">
							<span class="gn_name">业务日期&nbsp;:&nbsp;</span>
							<input type="text" id="cfbirthday" value="<%=date%>" name="fbizdate" onclick="WdatePicker({el:'cfbirthday',dateFmt:'yyyy-MM-dd'})">
							<img onclick="WdatePicker({el:'cfbirthday',dateFmt:'yyyy-MM-dd'})" 
				            src="<%=path%>/image/date.jpg"  align="absmiddle" style="padding-left: 15px">				
						</div>
						
				</div>
				<div class="div_input_hang">		
						<div class="input_hang">
							<span class="gn_name">备注&nbsp;:&nbsp;</span>
							<input type="text" class="student" name="fdescription" >
						</div>
						<div class="input_hang">
							<span class="gn_name">单据状态&nbsp;:&nbsp;</span>
							<select disabled="disabled" style="width: 200px">
								<option>新增
								</option>
							</select>
						</div>
				</div>	
				
					<div class="div_zilei" style="width: 72%;">
							<div style="width: 200px;text-align: left;float: left;color: #444444;font-size: 14px;"></div>
							<div style="text-align: right;float: left: ;">
								<img src="<%=path%>/image/insert2323.jpg" class="addTable">
								<span style="padding-right: 20px;color: #57a0ff;font-weight:700; font-size: 14px" class="addTable">添加</span>
								<img src="<%=path%>/image/delete212.png" class="deleteTable">
								<span class="deleteTable" style="color: #57a0ff;font-weight:700;font-size: 14px" class="deleteTable">删除</span>
							</div>
						</div>
						<div style="overflow:auto;height: 240px;width: 79%;padding-left: 20px">
								<table  width="100%" align="center" id="table1" style="min-height:50px;overflow:hidden;border-spacing:0;">
									<tr  class="tr">
										<td  width="20px"></td>
										<td width="200px" align="center">学员</td>
										<td width="200px" align="center">学员编码</td>
										<td width="200px" align="center">身份证号码</td>
										<td width="200px" align="center">性别</td>
										<td width="200px" align="center">车型</td>
										<td width="200px" align="center">手机</td>
										<td width="200px" align="center">班级</td>
										<td width="200px" align="center">备注</td>
									</tr>
								</table>
						</div>
				</div>
				<div class="div_tj" style="padding-top: 0px;margin-top: 0px;margin-left: 50px;">
					<div>
						<input onclick=" return check()" class="input_submit bc" value="" type="submit" style="margin-top: 0px; margin-right: 30px">
					</div>
					<div>
						<input type="button"  class="input_submit fh"  value="" onclick="back()" style="margin-top: 0px;"/>
					</div>
				</div>
			</form>
			</c:if>
			
			
			<!--  修改 -->
			<c:if test="${flag eq 2 }">
			<form action="<%=path%>/DrivingSys/updateSubjectFile" class="form" method="post">
				<div class="jlxx" >
				<div class="div_input_hang">
						<div class="input_hang">
							<span class="gn_name">驾校&nbsp;:&nbsp;</span>
							<input type="text" value="${subjectFile.cfficompanyName}" disabled="disabled" >	
							<input type="hidden"   id="fid" name="fid" value="${subjectFile.fid}"  >					
						</div>
						<div class="input_hang">
							<span class="gn_name">单据编号&nbsp;:&nbsp;</span>
							<input type="text" id="fnumber" value="${subjectFile.fnumber}" disabled="disabled" >
						</div>
						<div class="input_hang">
							<span class="gn_name">业务日期&nbsp;:&nbsp;</span>
							<c:if test="${subjectFile.cfbillstate eq 3}">								
								<input type="text" id="cfbirthday" value="${subjectFile.fbizdate}" name="fbizdate" onclick="WdatePicker({el:'cfbirthday',dateFmt:'yyyy-MM-dd'})">
								<img onclick="WdatePicker({el:'cfbirthday',dateFmt:'yyyy-MM-dd'})"
				            	src="<%=path%>/image/date.jpg"  align="absmiddle" style="padding-left: 15px">
							</c:if>
							<c:if test="${subjectFile.cfbillstate ne 3}">
								<input type="text" disabled="disabled" id="cfbirthday" value="${subjectFile.fbizdate}" name="fbizdate" onclick="WdatePicker({el:'cfbirthday',dateFmt:'yyyy-MM-dd'})">
								<img  
				            	src="<%=path%>/image/date.jpg"  align="absmiddle" style="padding-left: 15px">
							</c:if>			
						</div>
						
				</div>
				<div class="div_input_hang">		
					
						<div class="input_hang">
							<span class="gn_name">备注&nbsp;:&nbsp;</span>
							<c:if test="${subjectFile.cfbillstate eq 3}">	
							<input type="text" value="${subjectFile.fdescription}" class="student" name="fdescription" >
							</c:if>
							<c:if test="${subjectFile.cfbillstate ne 3}">
							<input type="text" disabled="disabled"  value="${subjectFile.fdescription}" class="student" name="fdescription" >
							</c:if>	
						</div>
						<div class="input_hang">
							<span class="gn_name">单据状态&nbsp;:&nbsp;</span>
							<select disabled="disabled" style="width: 200px">
								<c:if test="${subjectFile.cfbillstate eq 3}">
									<option  value="1">保存</option>
								</c:if>
								<c:if test="${subjectFile.cfbillstate eq 4}">
									<option  value="1">提交</option>
								</c:if>
								<c:if test="${subjectFile.cfbillstate eq 5}">
									<option  value="1">审核</option>
								</c:if>
							</select>
						</div>
				</div>	
				<div class="div_input_hang">		
					
						<div class="input_hang">
							<span class="gn_name">创建人&nbsp;:&nbsp;</span>
							<input disabled="disabled" type="text" value="${subjectFile.fcreateName}" class="student" name="fdescription" >	
						</div>
						<div class="input_hang">
							<span class="gn_name">创建时间&nbsp;:&nbsp;</span>
							<input disabled="disabled" type="text" value="${subjectFile.fcreatetime}" class="student" name="fdescription" >		
						</div>
						<div class="input_hang">
							<span class="gn_name">审核人&nbsp;:&nbsp;</span>
							<input disabled="disabled" type="text" value="${subjectFile.fauditorName}" class="student" name="fdescription" >		
						</div>
				</div>	
					<c:if test="${subjectFile.cfbillstate eq 3}">
					<div class="div_zilei" style="width: 72%;">
							<div style="width: 200px;text-align: left;float: left;color: #444444;font-size: 14px;"></div>
							<div style="text-align: right;float: left: ;">
								<img src="<%=path%>/image/insert2323.jpg"  class="addTable">
								<span style="padding-right: 20px;color: #57a0ff;font-weight:700;font-size: 14px;" class="addTable">添加</span>
								<img src="<%=path%>/image/delete212.png"  class="deleteTable">
								<span class="deleteTable" style="color: #57a0ff;font-weight:700;font-size: 14px;" class="deleteTable">删除</span>
							</div>
						</div>
					</c:if>
					 <c:if test="${subjectFile.cfbillstate ne 3}">
					 <%--<div class="div_zilei" style="width: 72%;">
							<div style="width: 200px;text-align: left;float: left;color: #444444;font-size: 14px;"></div>
							<div style="text-align: right;float: left: ;">
								<img src="<%=path%>/image/insert2323.jpg" style="cursor: not-allowed;" class="addTable">
								<span style="padding-right: 20px;color: #a9bbe0;font-size: 14px;cursor: not-allowed;" class="addTable">添加</span>
								<img src="<%=path%>/image/delete212.png" style="cursor: not-allowed;" class="deleteTable">
								<span class="deleteTable" style="color: #a9bbe0;font-size: 14px;cursor: not-allowed;" class="deleteTable">删除</span>
							</div>
						</div>--%>
					 </c:if>
						<div style="overflow:auto;height: 240px;width: 79%;padding-left: 20px">
								<table  width="100%" align="center" id="table1" style="min-height:50px;overflow:hidden;border-spacing:0;">
									<tr  class="tr">
										<c:if test="${subjectFile.cfbillstate eq 3}">
											<td  width="20px"></td>
										</c:if>
										<td width="200px" align="center">学员</td>
										<td width="200px" align="center">学员编码</td>
										<td width="200px" align="center">身份证号码</td>
										<td width="200px" align="center">性别</td>
										<td width="200px" align="center">车型</td>
										<td width="200px" align="center">手机</td>
										<td width="200px" align="center">班级</td>
										<td width="200px" align="center">备注</td>
									</tr>
									<c:forEach items="${subjectFileEntries}" var="subjectFileEntry" >
									<tr class="tr_td">
                                        <c:if test="${subjectFile.cfbillstate eq 3}">
                                            <td  width="20px">
                                                <input type="checkbox" name="item" >
                                            </td>
                                        </c:if>
										<td width="200px" align="center">
										<input type='text' style='width:200px' name="cfstudentName" readonly="readonly" value="${subjectFileEntry.cfstudentName}">
										<input type='hidden' name='cfstudentid' value="${subjectFileEntry.cfstudentid}" >
										</td>
										<td width="200px" align="center">
										<input type='text' name="cfstudentno" readonly="readonly" style='width:200px'  value="${subjectFileEntry.cfstudentno}">
										</td>
										<td width="200px" align="center">
										<input type='text' name="cfidcardno" readonly="readonly" style='width:200px' value="${subjectFileEntry.cfidcardno}">
										</td>
										<c:if test="${subjectFileEntry.cfsex eq 1}">
										<td width="200px" align="center">
										<input type='text' style='width:200px'  readonly="readonly" value="男">
										<input type='hidden' name='cfsex1' value="${subjectFileEntry.cfsex}" >
										</td>
										</c:if>
										<c:if test="${subjectFileEntry.cfsex eq 2}">
										<td width="200px" align="center">
										<input type='text' style='width:200px' readonly="readonly" value="女">
										<input type='hidden' name='cfsex1' value="${subjectFileEntry.cfsex}" >
										</td>
										</c:if>
										<c:if test="${subjectFileEntry.cfsex ne 1 && subjectFileEntry.cfsex ne 2}">
										<td width="200px" align="center">
										<input type='text' style='width:200px' readonly="readonly" value="">
										<input type='hidden' name='cfsex1' value="${subjectFileEntry.cfsex}" >
										</td>
										</c:if>
										<td width="200px" align="center">
										<input type='text' name="cfcx" style='width:200px' readonly="readonly"value="${subjectFileEntry.cfcx}">
										</td>
										<td width="200px" align="center">
										<input type='text' name="cfphone" style='width:200px' readonly="readonly"  value="${subjectFileEntry.cfphone}">
										</td>
										<td width="200px" align="center">
										<input type='text' name="cfclazz" style='width:200px'  readonly="readonly" value="${subjectFileEntry.cfclazz}">
										</td>
										<td width="200px" align="center">
										<input type='text' name="cfdesc" style='width:200px'  readonly="readonly" value="${subjectFileEntry.cfdesc}">
										</td>
										</tr>
									</c:forEach>
								</table>
						</div>
						
				</div>
				<div class="div_tj" style="padding-top: 0;">
				<c:if test="${subjectFile.cfbillstate eq 3}">
                    <shiro:hasPermission name="/selSubjectFileById">
					<div>
						<input onclick="return check()" class="input_submit bc" value="" type="submit">
					</div>
                    </shiro:hasPermission>
                    <shiro:hasPermission name="/submitSubjectFile">
                    <div>
                        <input onclick="return submitFlow()" class="input_submit tj" value="" type="submit">
                    </div>
                    </shiro:hasPermission>
				</c:if>
					<c:if test="${subjectFile.cfbillstate ne 3}">
					<c:if test="${subjectFile.cfbillstate eq 4}">
                    <c:if test="${seeFlag eq 'power'}">
                        <shiro:hasPermission name="/checkSubjectFileBillState">
                        <div>
                            <input  onclick="return agreeCommon()" class="input_submit sh" value="" type="submit" >
                        </div>
                        </shiro:hasPermission>
                    </c:if>
					</c:if>
						<shiro:hasPermission name="/uncheckSubjectFileBillState">
							<div>
								<input  onclick="return unagreeCommon()" class="input_submit fsh" value="" type="submit" >
							</div>
						</shiro:hasPermission>
					</c:if>

					<div>
						<input type="button" class="input_submit cklc" value="" onclick="lookActivitiImg('${ActivitiKey}',$('#fnumber').val())">
					</div>
					<div>
						<input type="button"  class="input_submit fh" onclick="back()" value="" />
					</div>
				</div>
				<input id="submitFlag" type="hidden" value="${submitFlag}">
			</form>
			
		  	</c:if>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<script type="text/javascript">

		$(document).ready(function () {
			var type = "${type}";
			if (type == '0' || type == '' || type == null) {

			} else {
				//alert("添加成功");
				editAlert();
			}
		})

        function submitFlow(){
            $.messager.confirm('提示', '是否提交该单据?', function (r) {
                if (r) {
                    $.ajax({
                        url: '<%=path%>/DrivingSys/submitSubjectFile',
                        type: "post",
                        data: {
                            'fnumber': $('#fnumber').val(),
                            'fid' : $("#fid").val(),
                            'submitFlag':$('#submitFlag').val()
                        },
                        async: false,
                        dataType: "json",
                        success: function (res) {
                           /* showAlert(res.msg,'/selectSubjectFile/look.action')*/
                            showAlert(res.msg,'/selSubjectFileById?fid='+$("#fid").val())

                            /*alert(res.msg)
                            location= ' <%=path%>/DrivingSys/selectSubjectFile/look.action';*/
                        },
                        error: function () {
                            alert('错误');
                        }
                    })
                }
            })
            return false
        }

        function agreeCommon() {
            $('.modal-data9').css('visibility','visible')
            $('#modal-overlay').css('visibility','visible')
            return false

        }
        function unagreeCommon() {
            $('.modal-data10').css('visibility','visible')
            $('#modal-overlay').css('visibility','visible')
            return false
        }

        $('#auditsubmit').click(function () {
            $('.auditcheck').each(function () {
                if ($(this).is(':checked')) {
                    $.ajax({
                        url: '<%=path%>/DrivingSys/checkSubjectFileBillState',
                        type: "post",
                        data: {
                            'fid': $('#fid').val(),
                            'fnumber': $('#fnumber').val(),
                            'state':5,
                            'agreed': $(this).val(),
                            'auditcomment': $('#auditcomment').val()
                        },
                        dataType: "json",
                        success: function (res) {
                            /*showAlert('审核成功','/selectSubjectFile/look.action')*/
                            showAlert('审核成功','/selSubjectFileById?fid='+$("#fid").val())
                            /*alert('审核成功')
                            location = '<%=path%>/DrivingSys/selectSubjectFile/look.action';*/
                        },
                        error: function () {
                            alert('错误');
                        }
                    })
                } else {

                }
            })
        })

        /*反审核*/
        $('#againstAuditsubmit').click(function () {
            $.ajax({
                url: '<%=path%>/DrivingSys/checkSubjectFileBillState',
                type: "post",
                data: {
                    'fid': $('#fid').val(),
                    'fnumber': $('#fnumber').val(),
                    'state': 3,
                    'agreed': 0,
                    'auditcomment': $('#auditcomment').val(),
                    'submitFlag':$('#submitFlag').val()
                },
                dataType: "json",
                success: function (res) {
                    /*showAlert(res.msg,'/selectSubjectFile/look.action')*/
                    showAlert(res.msg,'/selSubjectFileById?fid='+$("#fid").val())
                   /* alert(res.msg)
                    location = '<%=path%>/DrivingSys/selectSubjectFile/look.action';*/
                },
                error: function () {
                    alert('错误');
                }
            })
        })
/* 
     	$(".addTable").click(function(){
	
		}) */
		 function check(){
             if($('#table1 tr').length < 2){
                 alert('请您选择学员')
                 return false
             }
             if($('#cfbirthday').val() == ''){
                 alert('请您选择业务日期')
                 return false
             }
             $('form').submit(function() {
                 if(typeof jQuery.data(this, "disabledOnSubmit") == 'undefined') {
                     jQuery.data(this, "disabledOnSubmit", { submited: true });
                     $('input[type=submit], input[type=button]', this).each(function() {
                         $(this).attr("disabled", "disabled");
                     });
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             });
		 }
		
		
		$('.addTable').live('click',function(){
	
				$('#modal-overlay').css('visibility','visible')
				$('.modal-data').css('visibility','visible')
				$('input:checkbox').removeAttr('checked');
				$('.page').show()
		})

        /*//防止表单重复提交
     */
		
	
	
/*	$("#input_check1").live('click',function(){
		var fid = $('#fid').val()
		fid=fid.replace(/\+/g,"%2B");
		location.href="<%=path%>/DrivingSys/checkSubjectFileBillState?fid="+fid
	})*/

	
	$('.subtn').click(function(){
		  var spCodesTemp = "";
	      $('input:checkbox[name=student]:checked').each(function(i){
	       if(0==i){
	        spCodesTemp = $(this).val();
	       }else{
	        spCodesTemp += (","+$(this).val());
	       }
	      });
        if(spCodesTemp == "null" || spCodesTemp == ""){
            alert("请选择学员")
        }else {
            var tr_len = $("#table1 tr").length;//表格长
            $.ajax({
                url: '<%=path%>/DrivingSys/selStudentsByFid',
                type: "post",
                data: {'id': spCodesTemp},
                dataType: "json",
                success: function (json) {
                    var json = json.studentsNameList
                    var str = ''
                    for (var i = 0; i < json.length; i++) {
                        str += "<tr align='left' class='tr_td'><td style='width:20px' ><input type='checkbox' name='item'></td>";
                        str += "<td><input type='text' style='width:200px' readonly=\"readonly\"  name='cfstudentName'  value=" + json[i].fnameL2 + "><input type='hidden' name='cfstudentid' value=" + json[i].fid + " ></td>"
                        str += "<td><input type='text' style='width:200px' readonly=\"readonly\" value=" + json[i].fnumber + " name='cfstudentno' ></td>"
                        str += "<td><input type='text' style='width:200px'  readonly=\"readonly\"value=" + json[i].cfidcardno + " name='cfidcardno' ></td>"
                        if (json[i].cfsex == 1) {
                            str += "<td><input type='text' style='width:200px' value='男'   readonly=\"readonly\"></td>"
                            str += "<input type='hidden' name='cfsex1' value=" + json[i].cfsex + " >"
                        } else if (json[i].cfsex == 2) {
                            str += "<td><input type='text' style='width:200px' value='女' readonly=\"readonly\"></td>"
                            str += "<input type='hidden' name='cfsex1' value=" + json[i].cfsex + " >"
                        } else {
                            str += "<td><input type='text' style='width:200px' value='' readonly=\"readonly\"></td>"
                            str += "<input type='hidden' name='cfsex1' value=" + json[i].cfsex + " >"
                        }
                        str += "<td><input type='text' style='width:200px' value=" + json[i].cfslzjcxdh + " name='cfcx' readonly=\"readonly\"></td>"
                        str += "<td><input type='text' style='width:200px' value=" + json[i].cfsjhm + " name='cfphone' readonly=\"readonly\"></td>"
                        str += "<td><input type='text' style='width:200px' value=" + json[i].cfclazzName + " name='cfclazz' readonly=\"readonly\"></td>"
                        if (json[i].cfdesc == null) {
                            str += "<td><input type='text' style='width:200px' value='' name='cfdesc' readonly=\"readonly\"></td> </tr>"
                        } else {
                            str += "<td><input type='text' style='width:200px' value=" + json[i].cfdesc + " name='cfdesc' readonly=\"readonly\"></td> </tr>"
                        }

                    }
                    $("#table1").append(str)
                    $('#modal-overlay').css('visibility', 'hidden')
                    $('.modal-data').css('visibility', 'hidden')
                },
                error: function () {
                    alert('Error');
                }
            });
        }
	})
		
		
		
	$('.findBtn').live('click',function(){
		var myname=$('.modal-data1').find(".name1").val()
		$.ajax({
		    url:'<%=path%>/DrivingSys/selectWithHoldItemByName', 
		    type: "post",
		    data:{"name":myname},
		    dataType:"json",         	
		    success: function(json) {
		         var str=''
		         for(var i=0;i<json.length;i++) {
		         str+='<tr style="margin-top: 45px" ><td><input style="width: 15px;height: 15px" '
			               str+='type="checkbox" name="train"  value="'+json[i].fid+'"></td>'
			        	   str+='<td>'+json[i].fnameL2+'</td><td>'+json[i].fnumber+'</td>'
			        	   if(json[i].fsimplename == null) {
			        		   str+='<td></td>'	
			        	   }else{
			        		   str+='<td></td>'	
			        	   }
			        	   if(json[i].fdescriptionL2 == null) {
			        		   str+='<td>'+json[i].fdescriptionL2+'</td>'	
			        	   }else{
			        		   str+='<td>'+json[i].fdescriptionL2+'</td>'	
			        	   }	
		        		   str+='<td>'+json[i].fcreatetime+'</td><td>'+json[i].createName+'</td>'
		        		   str+='<td>'+json[i].flastupdatetime+'</td><td>'+json[i].updateName+'</td>'
		        		   str+='<td>'+json[i].cfficompanyName+'</td></tr>'		   
		         }
		         $(".head1 tr:not(':first')").remove()
		         $('.head1').append(str) 
			},  
			error: function(){alert('Error');} 
			});
		
	})
		
		
		
	/* 	$(function(){
	        $(':checkbox[type="checkbox"]').each(function(){
	            $(this).click(function(){
	                if($(this).attr('checked')){
	                    $(':checkbox[type="checkbox"]').removeAttr('checked');
	                    $(this).attr('checked','checked');
	                }
	            });
	        });
	    });
		 */

			//删除一行
			$(".deleteTable").click(function(){
				var tr_len = $("#table1 tr").length;
				if(tr_len == 1){

				}else{
					$('input:checkbox[name=item]:checked').each(function(i){
						$(this).parent().parent().remove();
					})
				}
			})
		
		$('.xysj').live('dblclick',function(){
            $(this).find("input:checkbox[name=student]").attr("checked", ":checked")
            var spCodesTemp = "";
            $('input:checkbox[name=student]:checked').each(function(i){
                if(0==i){
                    spCodesTemp = $(this).val();
                }else{
                    spCodesTemp += (","+$(this).val());
                }
            });
            var tr_len = $("#table1 tr").length;//表格长
            $.ajax({
                url:'<%=path%>/DrivingSys/selStudentsByFid',
                type: "post",
                data:{'id':spCodesTemp},
                dataType:"json",
                success: function(json) {
                    var json = json.studentsNameList
                    var str=''
                    for(var i=0;i<json.length;i++){
                        str += "<tr align='left' class='tr_td'><td style='width:20px' ><input type='checkbox' name='item'></td>";
                        str += "<td><input type='text' style='width:200px' readonly=\"readonly\" name='cfstudentName'  value="+json[i].fnameL2+"><input type='hidden' name='cfstudentid' value="+json[i].fid+" ></td>"
                        str += "<td><input type='text' style='width:200px' readonly=\"readonly\" value="+json[i].fnumber+" name='cfstudentno' ></td>"
                        str += "<td><input type='text' style='width:200px'  readonly=\"readonly\"value="+json[i].cfidcardno+" name='cfidcardno' ></td>"
                        if(json[i].cfsex == 1){
                            str += "<td><input type='text' style='width:200px' value='男'   readonly=\"readonly\"></td>"
                            str += "<input type='hidden' name='cfsex1' value="+json[i].cfsex+" >"
                        }else if(json[i].cfsex == 2){
                            str += "<td><input type='text' style='width:200px' value='女' readonly=\"readonly\"></td>"
                            str += "<input type='hidden' name='cfsex1' value="+json[i].cfsex+" >"
                        } else{
                            str += "<td><input type='text' style='width:200px' value='' readonly=\"readonly\"></td>"
                            str += "<input type='hidden' name='cfsex1' value="+json[i].cfsex+" >"
                        }
                        str += "<td><input type='text' style='width:200px' value="+json[i].cfslzjcxdh+" name='cfcx' readonly=\"readonly\"></td>"
                        str += "<td><input type='text' style='width:200px' value="+json[i].cfsjhm+" name='cfphone' readonly=\"readonly\"></td>"
                        str += "<td><input type='text' style='width:200px' value="+json[i].cfclazzName+" name='cfclazz' readonly=\"readonly\"></td>"
                        if(json[i].cfdesc == null) {
                            str += "<td><input type='text' style='width:200px' name='cfdesc' value=''  readonly=\"readonly\"></td> </tr>"
                        }else{
                            str += "<td><input type='text' style='width:200px' name='cfdesc' value="+json[i].cfdesc+"  readonly=\"readonly\"></td> </tr>"
                        }

                    }
                    $("#table1").append(str)
                    $('#modal-overlay').css('visibility','hidden')
                    $('.modal-data').css('visibility','hidden')
                },
                error: function(){alert('Error');}
            });
		})
		
		
		
		
		
			//返回
			function back(){
				location = '<%=path%>/DrivingSys/selectSubjectFile/look.action';
			}

        //单击选中复选框
        $(".tr_td").live('click',function(){
            var check = $(this).find("input[type='checkbox']");
            if(check){
                var flag = check[0].checked;
                if(flag){
                    check[0].checked = false;
                }else{
                    check[0].checked = true;
                }
            }

        });

        //阻止复选框进行冒泡事件
        $(".tr_td input[type='checkbox']").live('click',function(e){
            e.stopPropagation();
        });
		
			//取消
			$('.btn').click(function(){
					$('#modal-overlay').css('visibility','hidden')
					//$('.modal-data').css('visibility','hidden')
					$('.modal-data1').css('visibility','hidden')
					$('.modal-data2').css('visibility','hidden')
					$('.modal-data').css('visibility','hidden')
					$('input:checkbox').removeAttr('checked');
				})

		  	
	/* 	$('.student').click(function(){
			$('#modal-overlay').css('visibility','visible')
			$('.modal-data').css('visibility','visible')
			$('input:checkbox').removeAttr('checked');
			$('.page').show()
		})
		 */

</script>
</html>